package com.acane.instagram.core.model

import com.google.gson.annotations.SerializedName
import kotlinx.serialization.Serializable

@Serializable
data class UserInfo(
     @SerializedName("id") val id: String? = null,
     @SerializedName("userName")val userName: String? = null,
     @SerializedName("password")val password: String? = null,
     @SerializedName("nickName")val nickName: String? = null,
     @SerializedName("avatar")val avatar: String? = null,
     @SerializedName("email")val email: String? = null,
     @SerializedName("phone")val phone: String? = null,
     @SerializedName("sex")val sex: Int = 0,
     @SerializedName("introduction")val introduction: String? = null,
     @SerializedName("postCount")val postCount: Int = 0,
     @SerializedName("followerCount")val followerCount: Int = 0,
     @SerializedName("followingCount")val followingCount: Int = 0,
     @SerializedName("birthday") val birthday: String? = null,
     @SerializedName("createdTime") val createdTime: String? = null
) {
     companion object {
          fun fromMap(map: Map<String, Any>): UserInfo {
               return UserInfo(
                    id = map["id"] as String,
                    userName = map["userName"] as String,
                    password = map["password"] as String,
                    nickName = map["nickName"] as String,
                    avatar = map["avatar"] as String,
                    phone = map["phone"] as String,
                    email = map["email"] as String,
                    sex = map["sex"] as Int,
                    introduction = map["introduction"] as String,
                    postCount = map["postCount"] as Int,
                    followerCount = map["followerCount"] as Int,
                    followingCount = map["followingCount"] as Int
               )
          }
     }
}
